import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path' // 关键依赖[3](@ref)
// import styleImport from 'vite-plugin-style-import';

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src') // 必须指向项目根目录下的 src 文件夹
    }
  },
  server: {
    host: "0.0.0.0", // 允许所有网络接口访问
    port: 5173,
    proxy: {
      // 代理以api开头的请求
      '/satoken': {
        target: 'http://127.0.0.1:10428',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/satoken/, '')
      }
    }
  }
})
